<%--
  Created by IntelliJ IDEA.
  User: 86183
  Date: 2019/9/24
  Time: 17:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%String path = request.getContextPath();%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<table class="result-tab" width="100%">
    <tr>
        <th class="tc" width="5%"><input class="allChoose" name="" type="checkbox"></th>
        <th>ID</th>
        <th>姓名</th>
        <th>邮箱</th>
        <th>手机号</th>
        <th>注册时间</th>
        <th>最近登录时间</th>
        <th>操作</th>
    </tr >

    <c:forEach items="${requestScope.pageInfo.list}" var="userinfo" varStatus="stat">
        <tr>
            <td class="tc"><input name="id[]" value="59" type="checkbox"></td>
            <td class="id2">${userinfo.id}</td>

            <td class="name" data-id="${userinfo.id}">${userinfo.name}</td>
            <td>${userinfo.email}</td>
            <td>${userinfo.phone}</td>
            <td><fmt:formatDate value="${userinfo.registerTime}" pattern="yyyy-MM-dd"/></td>
            <td><fmt:formatDate value="${userinfo.lastLoginTime}" pattern="yyyy-MM-dd"/></td>
            <td>
            <span id="button">

                    <a data-id="${userinfo.id}" class="jiefeng" style="color:#3cff08;" href="#">解封</a>

            </span>


                &nbsp;


            </td>
        </tr>

    </c:forEach>

</table>
<tr>
    <div class="biankuang">
        <td colspan="7">
            <c:forEach  items="${requestScope.pageInfo.navigatepageNums}" var="i">
                <a href="#" id="ids" class="num" id="${i}">${i}</a>
            </c:forEach>
        </td>
    </div>
</tr>

<script type="text/javascript">
    var pageNum;
    $(".num").click(function () { //给页码加点击事件
        pageNum = $(this).html();
        findAll(pageNum);

        return false;
    });

    $.ajaxSettings.async = false;
    $(".jiefeng").on("click",function () { //解封
        if (window.confirm("你确定要解封吗?")) {
            var id = $(this).data("id");
            var enable=1;
            var action = "${pageContext.request.contextPath}/manage/show/deblocking"

            $.post(action,{id:id,enable:enable},function () {
                findAll(pageNum);
            })
        }
    })
    function findAll(pageNum)
    {
        var action ="${pageContext.request.contextPath}/manage/ajaxJsp/sethonor";
        $.post(action,{pageNum:pageNum},function (mes) {
            $("#show").html(mes);
        })

    }

    $(".result-tab .name").click(function () {


        var id = $(this).data("id");
        layer.open({

            type: 2,
            title: '用户信息。',
            shadeClose: true,
            shade: false,
            maxmin: true, //开启最大化最小化按钮
            area: ['893px', '600px'],
            content: '<%=path%>/manage/ajaxJsp/userdetails?id='+id
        });

    })



</script>